//
//	File Name   :	OpenGLExtensions.cpp
//	Description :	OpenGLExtensions implementation file.
//	Author		:	William McVicar
//  Mail		:	mcvicar.william@gmail.com
//

//  Precompiled Header
#include "CommonDefines.h"

#ifdef OPENGL
//  Library Includes

//  Local Includes

//  This includes
#include "OpenGLExtensions.h"

//	Macros
#define StaticDeclaration(function, type) OpenGLExtensions::type OpenGLExtensions::function

//  Static Variables

//  Static Function Prototypes

//  Implementation

// GL_ARB_color_buffer_float
StaticDeclaration(glClampColorARB, PFNGLCLAMPCOLORARBPROC);

// GL_ARB_draw_buffers
StaticDeclaration(glDrawBuffersARB, PFNGLDRAWBUFFERSARBPROC);

// GL_ARB_fragment_program
StaticDeclaration(glProgramStringARB, PFNGLPROGRAMSTRINGARBPROC);
StaticDeclaration(glBindProgramARB, PFNGLBINDPROGRAMARBPROC);
StaticDeclaration(glDeleteProgramsARB, PFNGLDELETEPROGRAMSARBPROC);
StaticDeclaration(glGenProgramsARB, PFNGLGENPROGRAMSARBPROC);
StaticDeclaration(glProgramEnvParameter4dARB, PFNGLPROGRAMENVPARAMETER4DARBPROC);
StaticDeclaration(glProgramEnvParameter4dvARB, PFNGLPROGRAMENVPARAMETER4DVARBPROC);
StaticDeclaration(glProgramEnvParameter4fARB, PFNGLPROGRAMENVPARAMETER4FARBPROC);
StaticDeclaration(glProgramEnvParameter4fvARB, PFNGLPROGRAMENVPARAMETER4FVARBPROC);
StaticDeclaration(glProgramLocalParameter4dARB, PFNGLPROGRAMLOCALPARAMETER4DARBPROC);
StaticDeclaration(glProgramLocalParameter4dvARB, PFNGLPROGRAMLOCALPARAMETER4DVARBPROC);
StaticDeclaration(glProgramLocalParameter4fARB, PFNGLPROGRAMLOCALPARAMETER4FARBPROC);
StaticDeclaration(glProgramLocalParameter4fvARB, PFNGLPROGRAMLOCALPARAMETER4FVARBPROC);
StaticDeclaration(glGetProgramEnvParameterdvARB, PFNGLGETPROGRAMENVPARAMETERDVARBPROC);
StaticDeclaration(glGetProgramEnvParameterfvARB, PFNGLGETPROGRAMENVPARAMETERFVARBPROC);
StaticDeclaration(glGetProgramLocalParameterdvARB, PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC);
StaticDeclaration(glGetProgramLocalParameterfvARB, PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC);
StaticDeclaration(glGetProgramivARB, PFNGLGETPROGRAMIVARBPROC);
StaticDeclaration(glGetProgramStringARB, PFNGLGETPROGRAMSTRINGARBPROC);
StaticDeclaration(glIsProgramARB, PFNGLISPROGRAMARBPROC);

// GL_ARB_multisample
StaticDeclaration(glSampleCoverage, PFNGLSAMPLECOVERAGEPROC);

// GL_ARB_multitexture
StaticDeclaration(glActiveTexture, PFNGLACTIVETEXTUREPROC);
StaticDeclaration(glClientActiveTexture, PFNGLCLIENTACTIVETEXTUREPROC);

// GL_ARB_shader_objects
StaticDeclaration(glDeleteObjectARB, PFNGLDELETEOBJECTARBPROC);
StaticDeclaration(glGetHandleARB, PFNGLGETHANDLEARBPROC);
StaticDeclaration(glDetachObjectARB, PFNGLDETACHOBJECTARBPROC);
StaticDeclaration(glCreateShaderObjectARB, PFNGLCREATESHADEROBJECTARBPROC);
StaticDeclaration(glShaderSourceARB, PFNGLSHADERSOURCEARBPROC);
StaticDeclaration(glCompileShaderARB, PFNGLCOMPILESHADERARBPROC);
StaticDeclaration(glCreateProgramObjectARB, PFNGLCREATEPROGRAMOBJECTARBPROC);
StaticDeclaration(glAttachObjectARB, PFNGLATTACHOBJECTARBPROC);
StaticDeclaration(glLinkProgramARB, PFNGLLINKPROGRAMARBPROC);
StaticDeclaration(glUseProgramObjectARB, PFNGLUSEPROGRAMOBJECTARBPROC);
StaticDeclaration(glValidateProgramARB, PFNGLVALIDATEPROGRAMARBPROC);
StaticDeclaration(glUniform1fARB, PFNGLUNIFORM1FARBPROC);
StaticDeclaration(glUniform2fARB, PFNGLUNIFORM2FARBPROC);
StaticDeclaration(glUniform3fARB, PFNGLUNIFORM3FARBPROC);
StaticDeclaration(glUniform4fARB, PFNGLUNIFORM4FARBPROC);
StaticDeclaration(glUniform1iARB, PFNGLUNIFORM1IARBPROC);
StaticDeclaration(glUniform2iARB, PFNGLUNIFORM2IARBPROC);
StaticDeclaration(glUniform3iARB, PFNGLUNIFORM3IARBPROC);
StaticDeclaration(glUniform4iARB, PFNGLUNIFORM4IARBPROC);
StaticDeclaration(glUniform1fvARB, PFNGLUNIFORM1FVARBPROC);
StaticDeclaration(glUniform2fvARB, PFNGLUNIFORM2FVARBPROC);
StaticDeclaration(glUniform3fvARB, PFNGLUNIFORM3FVARBPROC);
StaticDeclaration(glUniform4fvARB, PFNGLUNIFORM4FVARBPROC);
StaticDeclaration(glUniform1ivARB, PFNGLUNIFORM1IVARBPROC);
StaticDeclaration(glUniform2ivARB, PFNGLUNIFORM2IVARBPROC);
StaticDeclaration(glUniform3ivARB, PFNGLUNIFORM3IVARBPROC);
StaticDeclaration(glUniform4ivARB, PFNGLUNIFORM4IVARBPROC);
StaticDeclaration(glUniformMatrix2fvARB, PFNGLUNIFORMMATRIX2FVARBPROC);
StaticDeclaration(glUniformMatrix3fvARB, PFNGLUNIFORMMATRIX3FVARBPROC);
StaticDeclaration(glUniformMatrix4fvARB, PFNGLUNIFORMMATRIX4FVARBPROC);
StaticDeclaration(glGetObjectParameterfvARB, PFNGLGETOBJECTPARAMETERFVARBPROC);
StaticDeclaration(glGetObjectParameterivARB, PFNGLGETOBJECTPARAMETERIVARBPROC);
StaticDeclaration(glGetInfoLogARB, PFNGLGETINFOLOGARBPROC);
StaticDeclaration(glGetAttachedObjectsARB, PFNGLGETATTACHEDOBJECTSARBPROC);
StaticDeclaration(glGetUniformLocationARB, PFNGLGETUNIFORMLOCATIONARBPROC);
StaticDeclaration(glGetActiveUniformARB, PFNGLGETACTIVEUNIFORMARBPROC);
StaticDeclaration(glGetUniformfvARB, PFNGLGETUNIFORMFVARBPROC);
StaticDeclaration(glGetUniformivARB, PFNGLGETUNIFORMIVARBPROC);
StaticDeclaration(glGetShaderSourceARB, PFNGLGETSHADERSOURCEARBPROC);

// GL_ARB_texture_compression
StaticDeclaration(glCompressedTexImage1D, PFNGLCOMPRESSEDTEXIMAGE1DPROC);
StaticDeclaration(glCompressedTexImage2D, PFNGLCOMPRESSEDTEXIMAGE2DPROC);
StaticDeclaration(glCompressedTexImage3D, PFNGLCOMPRESSEDTEXIMAGE3DPROC);
StaticDeclaration(glCompressedTexSubImage1D, PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC);
StaticDeclaration(glCompressedTexSubImage2D, PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC);
StaticDeclaration(glCompressedTexSubImage3D, PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC);
StaticDeclaration(glGetCompressedTexImage, PFNGLGETCOMPRESSEDTEXIMAGEPROC);

// GL_ARB_vertex_buffer_object
StaticDeclaration(glBindBufferARB, PFNGLBINDBUFFERARBPROC);
StaticDeclaration(glDeleteBuffersARB, PFNGLDELETEBUFFERSARBPROC);
StaticDeclaration(glGenBuffersARB, PFNGLGENBUFFERSARBPROC);
StaticDeclaration(glIsBufferARB, PFNGLISBUFFERARBPROC);
StaticDeclaration(glBufferDataARB, PFNGLBUFFERDATAARBPROC);
StaticDeclaration(glBufferSubDataARB, PFNGLBUFFERSUBDATAARBPROC);
StaticDeclaration(glMapBufferARB, PFNGLMAPBUFFERARBPROC);
StaticDeclaration(glUnmapBufferARB, PFNGLUNMAPBUFFERARBPROC);
StaticDeclaration(glGetBufferParameterivARB, PFNGLGETBUFFERPARAMETERIVARBPROC);
StaticDeclaration(glGetBufferPointervARB, PFNGLGETBUFFERPOINTERVARBPROC);

// GL_ARB_vertex_program
StaticDeclaration(glVertexAttribPointerARB, PFNGLVERTEXATTRIBPOINTERARBPROC);
StaticDeclaration(glEnableVertexAttribArrayARB, PFNGLENABLEVERTEXATTRIBARRAYARBPROC);
StaticDeclaration(glDisableVertexAttribArrayARB, PFNGLDISABLEVERTEXATTRIBARRAYARBPROC);
StaticDeclaration(glGetVertexAttribdvARB, PFNGLGETVERTEXATTRIBDVARBPROC);
StaticDeclaration(glGetVertexAttribfvARB, PFNGLGETVERTEXATTRIBFVARBPROC);
StaticDeclaration(glGetVertexAttribivARB, PFNGLGETVERTEXATTRIBIVARBPROC);
StaticDeclaration(glGetVertexAttribPointervARB, PFNGLGETVERTEXATTRIBPOINTERVARBPROC);

// GL_ARB_vertex_shader
StaticDeclaration(glBindAttribLocationARB, PFNGLBINDATTRIBLOCATIONARBPROC);
StaticDeclaration(glGetActiveAttribARB, PFNGLGETACTIVEATTRIBARBPROC);
StaticDeclaration(glGetAttribLocationARB, PFNGLGETATTRIBLOCATIONARBPROC);

// GL_EXT_draw_range_elements
StaticDeclaration(glDrawRangeElements, PFNGLDRAWRANGEELEMENTSPROC);

// GL_EXT_framebuffer_object
StaticDeclaration(glIsRenderbufferEXT, PFNGLISRENDERBUFFEREXTPROC);
StaticDeclaration(glBindRenderbufferEXT, PFNGLBINDRENDERBUFFEREXTPROC);
StaticDeclaration(glDeleteRenderbuffersEXT, PFNGLDELETERENDERBUFFERSEXTPROC);
StaticDeclaration(glGenRenderbuffersEXT, PFNGLGENRENDERBUFFERSEXTPROC);
StaticDeclaration(glRenderbufferStorageEXT, PFNGLRENDERBUFFERSTORAGEEXTPROC);
StaticDeclaration(glGetRenderbufferParameterivEXT, PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC);
StaticDeclaration(glIsFramebufferEXT, PFNGLISFRAMEBUFFEREXTPROC);
StaticDeclaration(glBindFramebufferEXT, PFNGLBINDFRAMEBUFFEREXTPROC);
StaticDeclaration(glDeleteFramebuffersEXT, PFNGLDELETEFRAMEBUFFERSEXTPROC);
StaticDeclaration(glGenFramebuffersEXT, PFNGLGENFRAMEBUFFERSEXTPROC);
StaticDeclaration(glCheckFramebufferStatusEXT, PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC);
StaticDeclaration(glFramebufferTexture1DEXT, PFNGLFRAMEBUFFERTEXTURE1DEXTPROC);
StaticDeclaration(glFramebufferTexture2DEXT, PFNGLFRAMEBUFFERTEXTURE2DEXTPROC);
StaticDeclaration(glFramebufferTexture3DEXT, PFNGLFRAMEBUFFERTEXTURE3DEXTPROC);
StaticDeclaration(glFramebufferRenderbufferEXT, PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC);
StaticDeclaration(glGetFramebufferAttachmentParameterivEXT, PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC);
StaticDeclaration(glGenerateMipmapEXT, PFNGLGENERATEMIPMAPEXTPROC);

// GL_EXT_geometry_shader4
StaticDeclaration(glProgramParameteriEXT, PFNGLPROGRAMPARAMETERIEXTPROC);
StaticDeclaration(glFramebufferTextureEXT, PFNGLFRAMEBUFFERTEXTUREEXT);
StaticDeclaration(glFramebufferTextureLayerEXT, PFNGLFRAMEBUFFERTEXTURELAYEREXT);
StaticDeclaration(glFramebufferTextureFaceEXT, PFNGLFRAMEBUFFERTEXTUREFACEEXT);

// GL_EXT_stencil_two_side
StaticDeclaration(glActiveStencilFaceEXT, PFNGLACTIVESTENCILFACEEXT);

// GL_EXT_texture3D
StaticDeclaration(glTexImage3D, PFNGLTEXIMAGE3DPROC);
StaticDeclaration(glTexSubImage3D, PFNGLTEXSUBIMAGE3DPROC);

// GL_EXT_timer_query
StaticDeclaration(glGetQueryObjecti64vEXT, PFNGLGETQUERYOBJECTI64VEXTPROC);
StaticDeclaration(glGetQueryObjectui64vEXT, PFNGLGETQUERYOBJECTUI64VEXTPROC);

// GL_NV_shader_buffer_load
StaticDeclaration(glMakeBufferResidentNV, PFNGLMAKEBUFFERRESIDENTNVPROC);
StaticDeclaration(glMakeBufferNonResidentNV, PFNGLMAKEBUFFERNONRESIDENTNVPROC);
StaticDeclaration(glIsBufferResidentNV, PFNGLISBUFFERRESIDENTNVPROC);
StaticDeclaration(glMakeNamedBufferResidentNV, PFNGLMAKENAMEDBUFFERRESIDENTNVPROC);
StaticDeclaration(glMakeNamedBufferNonResidentNV, PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC);
StaticDeclaration(glIsNamedBufferResidentNV, PFNGLISNAMEDBUFFERRESIDENTNVPROC);
StaticDeclaration(glGetBufferParameterui64vNV, PFNGLGETBUFFERPARAMETERUI64VNVPROC);
StaticDeclaration(glGetNamedBufferParameterui64vNV, PFNGLGETNAMEDBUFFERPARAMETERUI64VNV);
StaticDeclaration(glGetIntegerui64vNV, PFNGLGETINTEGERUI64VNVPROC);
StaticDeclaration(glUniformui64NV, PFNGLUNIFORMUI64NV);
StaticDeclaration(glUniformui64vNV, PFNGLUNIFORMUI64VNV);
StaticDeclaration(glGetUniformui64vNV, PFNGLGETUNIFORMUI64VNV);
StaticDeclaration(glProgramUniformui64NV, PFNGLPROGRAMUNIFORMUI64NV);
StaticDeclaration(glProgramUniformui64vNV, PFNGLPROGRAMUNIFORMUI64VNV);

// GL_NV_vertex_buffer_unified_memory
StaticDeclaration(glBufferAddressRangeNV, PFNGLBUFFERADDRESSRANGENVPROC);
StaticDeclaration(glVertexFormatNV, PFNGLVERTEXFORMATNVPROC);
StaticDeclaration(glNormalFormatNV, PFNGLNORMALFORMATNVPROC);
StaticDeclaration(glColorFormatNV, PFNGLCOLORFORMATNVPROC);
StaticDeclaration(glIndexFormatNV, PFNGLINDEXFORMATNVPROC);
StaticDeclaration(glTexCoordFormatNV, PFNGLTEXCOORDFORMATNVPROC);
StaticDeclaration(glEdgeFlagFormatNV, PFNGLEDGEFLAGFORMATNVPROC);
StaticDeclaration(glSecondaryColorFormatNV, PFNGLSECONDARYCOLORFORMATNVPROC);
StaticDeclaration(glFogCoordFormatNV, PFNGLFOGCOORDFORMATNVPROC);
StaticDeclaration(glVertexAttribFormatNV, PFNGLVERTEXATTRIBFORMATNVPROC);
StaticDeclaration(glVertexAttribIFormatNV, PFNGLVERTEXATTRIBIFORMATNVPROC);
StaticDeclaration(glGetIntegerui64i_vNV, PFNGLGETINTEGERUI64I_VNVPROC);

#ifdef PROTEIN_PLATFORM_WINDOWS

    // WGL_ARB_extensions_string
    StaticDeclaration(wglGetExtensionsStringARB, PFNWGLGETEXTENSIONSSTRINGARBPROC);

#endif

/*
** Extensions::mapExtensions()
*/
void OpenGLExtensions::MapExtensions()
{
	#define MapFunction(function, type) function = reinterpret_cast< type >( wglGetProcAddress( #function ) )

    // GL_ARB_color_buffer_float
    MapFunction(glClampColorARB, PFNGLCLAMPCOLORARBPROC);

    // GL_ARB_draw_buffers
    MapFunction(glDrawBuffersARB, PFNGLDRAWBUFFERSARBPROC);

    // GL_ARB_fragment_program
    MapFunction(glProgramStringARB, PFNGLPROGRAMSTRINGARBPROC);
    MapFunction(glBindProgramARB, PFNGLBINDPROGRAMARBPROC);
    MapFunction(glDeleteProgramsARB, PFNGLDELETEPROGRAMSARBPROC);
    MapFunction(glGenProgramsARB, PFNGLGENPROGRAMSARBPROC);
    MapFunction(glProgramEnvParameter4dARB, PFNGLPROGRAMENVPARAMETER4DARBPROC);
    MapFunction(glProgramEnvParameter4dvARB, PFNGLPROGRAMENVPARAMETER4DVARBPROC);
    MapFunction(glProgramEnvParameter4fARB, PFNGLPROGRAMENVPARAMETER4FARBPROC);
    MapFunction(glProgramEnvParameter4fvARB, PFNGLPROGRAMENVPARAMETER4FVARBPROC);
    MapFunction(glProgramLocalParameter4dARB, PFNGLPROGRAMLOCALPARAMETER4DARBPROC);
    MapFunction(glProgramLocalParameter4dvARB, PFNGLPROGRAMLOCALPARAMETER4DVARBPROC);
    MapFunction(glProgramLocalParameter4fARB, PFNGLPROGRAMLOCALPARAMETER4FARBPROC);
    MapFunction(glProgramLocalParameter4fvARB, PFNGLPROGRAMLOCALPARAMETER4FVARBPROC);
    MapFunction(glGetProgramEnvParameterdvARB, PFNGLGETPROGRAMENVPARAMETERDVARBPROC);
    MapFunction(glGetProgramEnvParameterfvARB, PFNGLGETPROGRAMENVPARAMETERFVARBPROC);
    MapFunction(glGetProgramLocalParameterdvARB, PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC);
    MapFunction(glGetProgramLocalParameterfvARB, PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC);
    MapFunction(glGetProgramivARB, PFNGLGETPROGRAMIVARBPROC);
    MapFunction(glGetProgramStringARB, PFNGLGETPROGRAMSTRINGARBPROC);
    MapFunction(glIsProgramARB, PFNGLISPROGRAMARBPROC);

    // GL_ARB_multisample
    MapFunction(glSampleCoverage, PFNGLSAMPLECOVERAGEPROC);

    // GL_ARB_multitexture
    MapFunction(glActiveTexture, PFNGLACTIVETEXTUREPROC);
    MapFunction(glClientActiveTexture, PFNGLCLIENTACTIVETEXTUREPROC);

    // GL_ARB_shader_objects
    MapFunction(glDeleteObjectARB, PFNGLDELETEOBJECTARBPROC);
    MapFunction(glGetHandleARB, PFNGLGETHANDLEARBPROC);
    MapFunction(glDetachObjectARB, PFNGLDETACHOBJECTARBPROC);
    MapFunction(glCreateShaderObjectARB, PFNGLCREATESHADEROBJECTARBPROC);
    MapFunction(glShaderSourceARB, PFNGLSHADERSOURCEARBPROC);
    MapFunction(glCompileShaderARB, PFNGLCOMPILESHADERARBPROC);
    MapFunction(glCreateProgramObjectARB, PFNGLCREATEPROGRAMOBJECTARBPROC);
    MapFunction(glAttachObjectARB, PFNGLATTACHOBJECTARBPROC);
    MapFunction(glLinkProgramARB, PFNGLLINKPROGRAMARBPROC);
    MapFunction(glUseProgramObjectARB, PFNGLUSEPROGRAMOBJECTARBPROC);
    MapFunction(glValidateProgramARB, PFNGLVALIDATEPROGRAMARBPROC);
    MapFunction(glUniform1fARB, PFNGLUNIFORM1FARBPROC);
    MapFunction(glUniform2fARB, PFNGLUNIFORM2FARBPROC);
    MapFunction(glUniform3fARB, PFNGLUNIFORM3FARBPROC);
    MapFunction(glUniform4fARB, PFNGLUNIFORM4FARBPROC);
    MapFunction(glUniform1iARB, PFNGLUNIFORM1IARBPROC);
    MapFunction(glUniform2iARB, PFNGLUNIFORM2IARBPROC);
    MapFunction(glUniform3iARB, PFNGLUNIFORM3IARBPROC);
    MapFunction(glUniform4iARB, PFNGLUNIFORM4IARBPROC);
    MapFunction(glUniform1fvARB, PFNGLUNIFORM1FVARBPROC);
    MapFunction(glUniform2fvARB, PFNGLUNIFORM2FVARBPROC);
    MapFunction(glUniform3fvARB, PFNGLUNIFORM3FVARBPROC);
    MapFunction(glUniform4fvARB, PFNGLUNIFORM4FVARBPROC);
    MapFunction(glUniform1ivARB, PFNGLUNIFORM1IVARBPROC);
    MapFunction(glUniform2ivARB, PFNGLUNIFORM2IVARBPROC);
    MapFunction(glUniform3ivARB, PFNGLUNIFORM3IVARBPROC);
    MapFunction(glUniform4ivARB, PFNGLUNIFORM4IVARBPROC);
    MapFunction(glUniformMatrix2fvARB, PFNGLUNIFORMMATRIX2FVARBPROC);
    MapFunction(glUniformMatrix3fvARB, PFNGLUNIFORMMATRIX3FVARBPROC);
    MapFunction(glUniformMatrix4fvARB, PFNGLUNIFORMMATRIX4FVARBPROC);
    MapFunction(glGetObjectParameterfvARB, PFNGLGETOBJECTPARAMETERFVARBPROC);
    MapFunction(glGetObjectParameterivARB, PFNGLGETOBJECTPARAMETERIVARBPROC);
    MapFunction(glGetInfoLogARB, PFNGLGETINFOLOGARBPROC);
    MapFunction(glGetAttachedObjectsARB, PFNGLGETATTACHEDOBJECTSARBPROC);
    MapFunction(glGetUniformLocationARB, PFNGLGETUNIFORMLOCATIONARBPROC);
    MapFunction(glGetActiveUniformARB, PFNGLGETACTIVEUNIFORMARBPROC);
    MapFunction(glGetUniformfvARB, PFNGLGETUNIFORMFVARBPROC);
    MapFunction(glGetUniformivARB, PFNGLGETUNIFORMIVARBPROC);
    MapFunction(glGetShaderSourceARB, PFNGLGETSHADERSOURCEARBPROC);

    // GL_ARB_texture_compression
    MapFunction(glCompressedTexImage1D, PFNGLCOMPRESSEDTEXIMAGE1DPROC);
    MapFunction(glCompressedTexImage2D, PFNGLCOMPRESSEDTEXIMAGE2DPROC);
    MapFunction(glCompressedTexImage3D, PFNGLCOMPRESSEDTEXIMAGE3DPROC);
    MapFunction(glCompressedTexSubImage1D, PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC);
    MapFunction(glCompressedTexSubImage2D, PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC);
    MapFunction(glCompressedTexSubImage3D, PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC);
    MapFunction(glGetCompressedTexImage, PFNGLGETCOMPRESSEDTEXIMAGEPROC);

    // GL_ARB_vertex_buffer_object
    MapFunction(glBindBufferARB, PFNGLBINDBUFFERARBPROC);
    MapFunction(glDeleteBuffersARB, PFNGLDELETEBUFFERSARBPROC);
    MapFunction(glGenBuffersARB, PFNGLGENBUFFERSARBPROC);
    MapFunction(glIsBufferARB, PFNGLISBUFFERARBPROC);
    MapFunction(glBufferDataARB, PFNGLBUFFERDATAARBPROC);
    MapFunction(glBufferSubDataARB, PFNGLBUFFERSUBDATAARBPROC);
    MapFunction(glMapBufferARB, PFNGLMAPBUFFERARBPROC);
    MapFunction(glUnmapBufferARB, PFNGLUNMAPBUFFERARBPROC);
    MapFunction(glGetBufferParameterivARB, PFNGLGETBUFFERPARAMETERIVARBPROC);
    MapFunction(glGetBufferPointervARB, PFNGLGETBUFFERPOINTERVARBPROC);

    // GL_ARB_vertex_program
    MapFunction(glVertexAttribPointerARB, PFNGLVERTEXATTRIBPOINTERARBPROC);
    MapFunction(glEnableVertexAttribArrayARB, PFNGLENABLEVERTEXATTRIBARRAYARBPROC);
    MapFunction(glDisableVertexAttribArrayARB, PFNGLDISABLEVERTEXATTRIBARRAYARBPROC);
    MapFunction(glGetVertexAttribdvARB, PFNGLGETVERTEXATTRIBDVARBPROC);
    MapFunction(glGetVertexAttribfvARB, PFNGLGETVERTEXATTRIBFVARBPROC);
    MapFunction(glGetVertexAttribivARB, PFNGLGETVERTEXATTRIBIVARBPROC);
    MapFunction(glGetVertexAttribPointervARB, PFNGLGETVERTEXATTRIBPOINTERVARBPROC);

    // GL_ARB_vertex_shader
    MapFunction(glBindAttribLocationARB, PFNGLBINDATTRIBLOCATIONARBPROC);
    MapFunction(glGetActiveAttribARB, PFNGLGETACTIVEATTRIBARBPROC);
    MapFunction(glGetAttribLocationARB, PFNGLGETATTRIBLOCATIONARBPROC);

    // GL_EXT_draw_range_elements
    MapFunction(glDrawRangeElements, PFNGLDRAWRANGEELEMENTSPROC);

    // GL_EXT_framebuffer_object
    MapFunction(glIsRenderbufferEXT, PFNGLISRENDERBUFFEREXTPROC);
    MapFunction(glBindRenderbufferEXT, PFNGLBINDRENDERBUFFEREXTPROC);
    MapFunction(glDeleteRenderbuffersEXT, PFNGLDELETERENDERBUFFERSEXTPROC);
    MapFunction(glGenRenderbuffersEXT, PFNGLGENRENDERBUFFERSEXTPROC);
    MapFunction(glRenderbufferStorageEXT, PFNGLRENDERBUFFERSTORAGEEXTPROC);
    MapFunction(glGetRenderbufferParameterivEXT, PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC);
    MapFunction(glIsFramebufferEXT, PFNGLISFRAMEBUFFEREXTPROC);
    MapFunction(glBindFramebufferEXT, PFNGLBINDFRAMEBUFFEREXTPROC);
    MapFunction(glDeleteFramebuffersEXT, PFNGLDELETEFRAMEBUFFERSEXTPROC);
    MapFunction(glGenFramebuffersEXT, PFNGLGENFRAMEBUFFERSEXTPROC);
    MapFunction(glCheckFramebufferStatusEXT, PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC);
    MapFunction(glFramebufferTexture1DEXT, PFNGLFRAMEBUFFERTEXTURE1DEXTPROC);
    MapFunction(glFramebufferTexture2DEXT, PFNGLFRAMEBUFFERTEXTURE2DEXTPROC);
    MapFunction(glFramebufferTexture3DEXT, PFNGLFRAMEBUFFERTEXTURE3DEXTPROC);
    MapFunction(glFramebufferRenderbufferEXT, PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC);
    MapFunction(glGetFramebufferAttachmentParameterivEXT, PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC);
    MapFunction(glGenerateMipmapEXT, PFNGLGENERATEMIPMAPEXTPROC);

    // GL_EXT_geometry_shader4
    MapFunction(glProgramParameteriEXT, PFNGLPROGRAMPARAMETERIEXTPROC);
    MapFunction(glFramebufferTextureEXT, PFNGLFRAMEBUFFERTEXTUREEXT);
    MapFunction(glFramebufferTextureLayerEXT, PFNGLFRAMEBUFFERTEXTURELAYEREXT);
    MapFunction(glFramebufferTextureFaceEXT, PFNGLFRAMEBUFFERTEXTUREFACEEXT);

    // GL_EXT_stencil_two_side
    MapFunction(glActiveStencilFaceEXT, PFNGLACTIVESTENCILFACEEXT);

    // GL_EXT_texture3D
    MapFunction(glTexImage3D, PFNGLTEXIMAGE3DPROC);
    MapFunction(glTexSubImage3D, PFNGLTEXSUBIMAGE3DPROC);

    // GL_EXT_timer_query
    MapFunction(glGetQueryObjecti64vEXT, PFNGLGETQUERYOBJECTI64VEXTPROC);
    MapFunction(glGetQueryObjectui64vEXT, PFNGLGETQUERYOBJECTUI64VEXTPROC);

    // GL_NV_shader_buffer_load
    MapFunction(glMakeBufferResidentNV, PFNGLMAKEBUFFERRESIDENTNVPROC);
    MapFunction(glMakeBufferNonResidentNV, PFNGLMAKEBUFFERNONRESIDENTNVPROC);
    MapFunction(glIsBufferResidentNV, PFNGLISBUFFERRESIDENTNVPROC);
    MapFunction(glMakeNamedBufferResidentNV, PFNGLMAKENAMEDBUFFERRESIDENTNVPROC);
    MapFunction(glMakeNamedBufferNonResidentNV, PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC);
    MapFunction(glIsNamedBufferResidentNV, PFNGLISNAMEDBUFFERRESIDENTNVPROC);
    MapFunction(glGetBufferParameterui64vNV, PFNGLGETBUFFERPARAMETERUI64VNVPROC);
    MapFunction(glGetNamedBufferParameterui64vNV, PFNGLGETNAMEDBUFFERPARAMETERUI64VNV);
    MapFunction(glGetIntegerui64vNV, PFNGLGETINTEGERUI64VNVPROC);
    MapFunction(glUniformui64NV, PFNGLUNIFORMUI64NV);
    MapFunction(glUniformui64vNV, PFNGLUNIFORMUI64VNV);
    MapFunction(glGetUniformui64vNV, PFNGLGETUNIFORMUI64VNV);
    MapFunction(glProgramUniformui64NV, PFNGLPROGRAMUNIFORMUI64NV);
    MapFunction(glProgramUniformui64vNV, PFNGLPROGRAMUNIFORMUI64VNV);

    // GL_NV_vertex_buffer_unified_memory
    MapFunction(glBufferAddressRangeNV, PFNGLBUFFERADDRESSRANGENVPROC);
    MapFunction(glVertexFormatNV, PFNGLVERTEXFORMATNVPROC);
    MapFunction(glNormalFormatNV, PFNGLNORMALFORMATNVPROC);
    MapFunction(glColorFormatNV, PFNGLCOLORFORMATNVPROC);
    MapFunction(glIndexFormatNV, PFNGLINDEXFORMATNVPROC);
    MapFunction(glTexCoordFormatNV, PFNGLTEXCOORDFORMATNVPROC);
    MapFunction(glEdgeFlagFormatNV, PFNGLEDGEFLAGFORMATNVPROC);
    MapFunction(glSecondaryColorFormatNV, PFNGLSECONDARYCOLORFORMATNVPROC);
    MapFunction(glFogCoordFormatNV, PFNGLFOGCOORDFORMATNVPROC);
    MapFunction(glVertexAttribFormatNV, PFNGLVERTEXATTRIBFORMATNVPROC);
    MapFunction(glVertexAttribIFormatNV, PFNGLVERTEXATTRIBIFORMATNVPROC);
    MapFunction(glGetIntegerui64i_vNV, PFNGLGETINTEGERUI64I_VNVPROC);

#ifdef PROTEIN_PLATFORM_WINDOWS
    // WGL_ARB_extensions_string
    MapFunction(wglGetExtensionsStringARB, PFNWGLGETEXTENSIONSSTRINGARBPROC);
#endif
}
#endif //OPENGL
